1. Technical Field
The present invention relates in general to a method and system for data processing and in particular to a method and system for processing data input to a data processing system utilizing an input device having a number of keys. Still more particularly, the present invention relates to a method and system for translating keyboard scan codes from a variety of different keyboards and devices into codes which may be utilized by a number of data processing systems having diverse operating systems.
2. Description of Related Art
Prior art such as disclosed in Rose, U.S. Pat. No. 5,623,261, xe2x80x9cA Method And System For Translating Keyed Input Within A Data Processing Systemxe2x80x9d, which is incorporated by reference in it entirety here within, discloses conventional key codes translation utilizing an operation system""s virtual key codes. A number of input devices such as mice, touch screens, digitizing tablets and speech devices have been recently developed to enhance user interface to data processing systems, however, the keyboard in one form or another remains the primary device utilized to input data to data processing systems. A typical keyboard includes a number of keys, which are cache associated with at least one character or function. For example, the enhanced keyboard commonly utilized with personal computers such as the IBM Personal System 2 (PS/2) has 101 keys, including alphanumeric character keys, key modifiers or keyboard state keys (Alt, Shift, Ctrl., number lock etc.), cursor positioning keys, and 12 function keys (F1-F12).
In a typical personal computer system, keystrokes are detected by a microcontroller within the keyboard which continuously scans each of the keys to determine if a key has been pressed or released. When a change in the state of a key is detected, the microcontroller generates a unique scan code which specifies the key that has changed state and whether the key has been pressed (a make code) or released (a break code). The microcontroller within the keyboard then serially transmits the scan code generated by the keystroke, which is typically one or two bytes in length, to a keyboard driver within the system unit. The keyboard driver, in turn, issues an interrupt to the central microprocessor (CPU) indicating that a scan code is available to be read.
After the scan code generated by the keyboard microcontroller is read by the CPU, the CPU translates the scan code into an input code recognizable by the personal computer operating system utilizing a translation table within the Basic Input/Output System (BIOS) code stored in ROM. The translation table is arranged as a fixed length array in which a number of scan codes are stored in association with corresponding input coces. As will be understood by those skilled in the art, the translation table must supply a scan code translation for each combination of keyboard type and country layout (i.e., national language) supported by the personal computer system. Because a number of keyboard behaviors are unique to a specific country layout, the translation table typically includes hardcoded operating system-dependent commands in order to reduce the memory required to store the translation table. For example, translation tables may include operating system-dependent commands to translate scan codes input in conjunction with particular key modifiers (e.g., xe2x80x9caxe2x80x9d with Caps Lock and Shift) for a particular country layout. After the CPU has translated the input scan code into an input code by referencing the translation table, the input code is processed in accordance with the operating system software executing within the CPU.
Although the conventional method of converting keyboard keystrokes into character and function input codes performs efficiently for a given combination of keyboard hardware, country layout, and operating system, a problem arises when the growing number of keyboard configuration and operating systems is considered. Since the translation table which converts scan codes into character and function input codes contains operating system-dependent special purpose code written specifically for each combination of country layout and keyboard hardware, the translation table is not transportable between data processing systems utilizing different operating systems and keyboard hardware. Thus, a translation table must be written for each permutation of operating system, country layout, and keyboard hardware.
The problem is that there are hundreds of devices that fall in the category of computer keyboard. The most common devices range from 80 to 122 keys. The key positions and the mapping of individual keys on these keyboards produce different scan codes that typically, but not always, fall into one of three standards (scan sets 1, 2, 3). These scan codes must in turn be mapped to a character output base on the language being used. As described above, this is typically done through a translation table, a virtual key code. In one example, a scan under scan 3, a scan code of 0x5d would map to a backslash on a Japanese keyboard. A U.S. keyboard would not produce this result since it does not have a key in the exact position as the Japanese keyboard. However, the U.S. keyboard would produce a backslash with a different scan code. Interestingly, a U.S. 102 keyboard would also produce a different scan code for a backslash than a U.S. 122 keyboard. Therefore, two different U.S. keyboards could produce different scan codes for the same character output. Further complicating the problem of keyboard-generated scan codes is some manufacturer""s practice of placing extra functions on a keyboard such as cut, copy, paste, or an operating system home key.
It can be seen that the number tables needed to support all of the potential input devices available, in each country""s layout and local dialect, becomes unwieldy to store and manage. For each keyboard supported the operating system must have available to it keyboard mapping conversion tables to each country and/or local country dialect. The prior art dedicates an enormous amount of memory space to translation tables for keyboards and country languages.
Additionally, in order to support additional keyboards prior art must dedicate more memory space for the keyboard layout as well as translation mappings for each country and local country dialects for support in those countries.
Further, functional keyboards such as ergonomic keyboards become a problem as the keys can be rearranged on the face of the keyboard. The prior art adequately handles the case where the scan codes remain the same for the character representations, however, the scan codes change in response to repositioning the keys entire new set of translation tables must be constructed in addition to modifying the device driver for-the keyboard.
Finally, the prior art is inflexible because modifications such as adding or deleting keys or adding new functionality to keys require modifying virtually every translation table associated with the keyboard. Therefore, it would be advantageous to have an improved method and apparatus for processing scan codes from different types of input devices.
One advantage of the present invention is to reduce the enormous memory consumption of the translation tables by creating an additional layer of abstraction for mapping all known keyboard inputs.
Another advantage is to create a hardware dependent key code class for modifying the hardware and maintaining a set of country language and local dialect code tables which can be reused with all available input devices.
Still another advantage of the present invention is to provide flexible support for variable placement keyboards such as ergonomic keyboards.
Still another advantage of the present invention is to provide the flexibility needed to modify individual key associations without modifying every country language and local dialect table.
Still another advantage of the present invention is to allow any device to function as a keyboard.
Still another advantage of the present invention is to supply multiple keyboard mappings simultaneously in different languages.
Still another advantage of the present invention is to provide support for using multiple real keyboards simultaneously.
Still another advantage of the present invention is to pass the keyboard state to the operating system virtual Key Tables.
Present invention includes a system, method and software embodiment of a method for processing scan codes from a plurality of input devices by receiving the scan codes from the input devices, mapping signals to an abstract virtual code contained in an abstract code table, then determining an output code of each abstract virtual codes by selecting a conversion table related to the country code or local dialect and determining an entry point on the selected conversion table based on the abstract virtual codes mapped from the abstract Key Table. By doing so, an operating system can support multiple keyboards from different vendors each having different keyboard layouts, simultaneously. Rather than creating separate tables for each input device, the abstract Key Table reuses codes from one keyboard to another and adds only codes as needed to define keys which are not defined in the abstract Key Table.